/*
 * StudentConnection.cpp
 *
 *  Created on: 30/05/2011
 *      Author: dela
 */

#include "StudentConnection.h"

/**
 *
 */
void StudentConnection::run() {
	char *data;
	while (isWorking()) {
		// Recivo tipo de operación:
		if (socket.receiveData(&data) > 0) {
			switch (*data) {
			case 1:  // Es un login
				doLogin('S');
				break;
			case 3:  // Obtener lista de cursos
				returnCourses();
				break;
			case 5:  // Obtener lista de clases
				returnClasses();
				break;
			}
			delete[] data;
			data = NULL;
		}
		if ( data != NULL ) {
			delete[] data;
		}
	}
}
